/**
 * 
 */
package com.lunevich.json.tasks;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONObject;

import com.lunevich.json.helpers.HttpManager;

import android.content.Context;

/**
 * @author Andrei_Lunevich
 *
 */
public abstract class JSONObjectAsyncTask<T> extends CommonAsyncTask<T> {

	private Context context;
	
	public JSONObjectAsyncTask(Context context) {
		this.context = context;
	}
	
	@Override
	public List<T> onLoad(String url) throws Exception {
		ArrayList<T> twitterList = new ArrayList<T>();
		JSONObject jsonObject = HttpManager.getHttpManager(context).getJSONObjectFromUrl(url, context); 
		twitterList.add(createWrapper(jsonObject));
		return twitterList;
	}
	
	public abstract T createWrapper(JSONObject object);
}